package demo

import (
	"encoding/json"
	"fmt"
)

func Sorting() {
	Init()
	//根据年龄降序并且去重 desc降序 asc升序
	//Order 排序
	//Distinct 去重
	var Advanced []Advanced
	DB.Order("age desc").Distinct("age").Find(&Advanced)
	json, _ := json.Marshal(Advanced)
	fmt.Println(string(json))
}
